import { Injectable } from '@angular/core'
import { HttpClientService } from '../httpClient/http'

@Injectable({
  providedIn: 'root'
})
export class LoginService {
  constructor(private http: HttpClientService) {}

  // 获取验证码
  getCaptcha(reqdata, callback, errorBack?) {
    this.http.post(reqdata, '/Platform/Json/CaptchaService.svc/Send', callback, errorBack)
  }
  // 校验验证码
  checkCaptcha(reqdata, callback, errorBack?) {
    this.http.post(reqdata, '/Platform/Json/CaptchaService.svc/Validate', callback, errorBack)
  }
  // 登录注册
  login(reqdata, callback, errorBack?) {
    this.http.post(reqdata, '/Platform/Json/UserService.svc/RegisterOrLogin', callback, errorBack)
  }
  loginWithPsw(reqdata, callback, errorBack?) {
    this.http.post(reqdata, '/Platform/Json/UserService.svc/Login', callback, errorBack)
  }
}
